package com.itheima.edu.info.manager.day8;

import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
PaiXu px=new PaiXu("王a",18);
PaiXu px1=new PaiXu("王b",18);
PaiXu px2=new PaiXu("王c",18);
PaiXu px3=new PaiXu("王八",18);
        Collator instance = Collator.getInstance(Locale.CHINA);
        TreeSet<PaiXu>ts=new TreeSet<>((PaiXu o1,PaiXu o2)->{
            int result = o1.getAge() - o2.getAge();
            result= result==0?instance.compare(o1.getName(),o2.getName()):result;
            return result;
        });
        ts.add(px);
        ts.add(px1);
        ts.add(px2);
        ts.add(px3);
        System.out.println(ts);
    }/*Collator instance = Collator.getInstance(Locale.CHINA);

    TreeSet<PaiXu>ts=new TreeSet<>(new Comparator<PaiXu>() {
        @Override
        public int compare(PaiXu o1, PaiXu o2) {
            int result=o1.getAge()-o2.getAge();
            result= result==0?instance.compare(o1.getName(),o2.getName()):result;
            return result;
        }
    });*/

}
